package com.leetcode.链表;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

//环形链表
public class lc_141 {
    public static void main(String[] args) {
        ListNode a = new ListNode(1);
    }

    public static boolean hasCycle(ListNode head){
        ListNode dumNode = new ListNode();
        dumNode.next = head;
        ListNode fast  = head;
        ListNode low = dumNode;
        while( fast != low){
            if(fast == null || fast.next == null){
                return false;
            }
            fast = fast.next.next;
            low = low.next;
        }
        return true;
    }
}
